import { createApp } from 'vue'
import router from './router'
import store from './store'
import App from './App.vue'
//less文件
import '@/styles/index.less'
//ant-design-vue
import Antd from 'ant-design-vue'
import 'ant-design-vue/dist/antd.less'; // 引入官方提供的 less 样式入口文件
import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper';

import i18n from './i18n'
//vxe-table
import 'xe-utils'
import VXETable from 'vxe-table'
VXETable.setup({
  // 对组件内置的提示语进行国际化翻译
  i18n: (key, args) => i18n.global.t(key, args)
})
import bzComponents from "./config/bzComponents"

import 'vxe-table/lib/style.css'
import Directives from '@/utils/directives';
import moment from 'moment'
import 'moment/locale/zh-cn'
moment.locale('zh-cn')
import * as echarts from 'echarts'
let app: any;
// 没有乾坤时，即独立运行
if (!qiankunWindow.__POWERED_BY_QIANKUN__) {
  console.log("77777777");
  // render();
  // createApp(App).use(router).mount('#app');
  const app = createApp(App)
  app.config.globalProperties.$moment = moment
  //引入echarts
  app.config.globalProperties.$echarts = echarts
  // app.provide<any>('echarts',echarts)
  app.use(store)
  app.use(router)
  app.use(Antd)
  app.use(VXETable)
  app.use(i18n);
  app.use(Directives)
  app.use(bzComponents)
  app.mount('#app')
} else {
  console.log("555555");
  renderWithQiankun({
    mount(props) {
      app = createApp(App);
      app.config.globalProperties.$moment = moment
      //引入echarts
      app.config.globalProperties.$echarts = echarts
      // app.provide<any>('echarts',echarts)
      app.use(store)
      app.use(router)
      app.use(Antd)
      app.use(VXETable)
      app.use(i18n);
      app.use(Directives)
      app.use(bzComponents)
      // app.mount('#app')
      app.mount(props.container?.querySelector('#app'));
    },
    bootstrap() {
      console.log('bootstrap');
    },
    update() {
      console.log('update');
    },
    unmount() {
      console.log('unmount');
      app?.unmount();
    }
  });
}
//时间格式

